//
//  SongsControlAndInfoView.m
//  WXMusic
//
//  Created by 漫步人生路 on 15/9/7.
//  Copyright (c) 2015年 漫步人生路. All rights reserved.
//

#import "SongsControlAndInfoView.h"

@implementation SongsControlAndInfoView

- (instancetype)initWithFrame:(CGRect)frame
{
    self = [super initWithFrame:frame];
    if (self) {
        self.starTime = [[CUSFlashLabel alloc]initWithFrame:CGRectMake(10, 0, 35, 35)];
        self.starTime.text = @"0:00";
        
        self.stopTime = [[CUSFlashLabel alloc]initWithFrame:CGRectMake(kWidth - 45, 0, 35, 35)];
        self.stopTime.text = @"0:00";
        [self setTimeLabel:self.starTime];
        [self setTimeLabel:self.stopTime];
        
        
        self.songProgress = [[UISlider alloc]initWithFrame:CGRectMake(0, 35, kWidth, 20)];
        self.songProgress.minimumTrackTintColor = [UIColor whiteColor];
        self.songProgress.maximumTrackTintColor = [UIColor grayColor];
        [self addSubview:self.songProgress];
        self.songName = [[CUSFlashLabel alloc]initWithFrame:CGRectMake(0, 45, kWidth, 30)];
        [self setSongInfo:self.songName font:17.0];
        self.singerName = [[CUSFlashLabel alloc]initWithFrame:CGRectMake(20, 80, kWidth - 40, 20)];
        [self setSongInfo:self.singerName font:14.0];
        self.playOrderButton = [UIButton buttonWithType:UIButtonTypeSystem];
        [self setUpAllButton:self.playOrderButton frame:CGRectMake(kWidth / 25, kHeight/5, kWidth / 9.35, kHeight / 16.67) image:@"bt_playpagen_control_order_normal"];
        self.playOrderButton.tag = 1001;
        self.lastButton = [UIButton buttonWithType:UIButtonTypeSystem];
        [self setUpAllButton:self.lastButton frame:CGRectMake(kWidth / 4.54, kHeight/5, kWidth / 9.35, kHeight / 16.67) image:@"player_prev"];
        self.playButton = [UIButton buttonWithType:UIButtonTypeSystem];
        [self setUpAllButton:self.playButton frame:CGRectMake(kWidth / 3.01, kHeight/7, kWidth / 3.1,kHeight / 5.55) image:@"player_play"];
        self.nextButton = [UIButton buttonWithType:UIButtonTypeSystem];
        [self setUpAllButton:self.nextButton frame:CGRectMake(kWidth / 1.51, kHeight/5, kWidth / 9.35, kHeight / 16.67) image:@"player_next"];
        self.downloadButton = [UIButton buttonWithType:UIButtonTypeSystem];
        [self setUpAllButton:self.downloadButton frame:CGRectMake(kWidth / 1.18, kHeight/5, kWidth / 9.35, kHeight / 16.67) image:@"player_download"];
        
        

    }
    return self;
}

- (void)setUpSongName:(NSString *)songName singeName:(NSString *)singerName
{
    self.songName.text = songName;
    self.singerName.text = singerName;
}
- (void)setUpAllButton:(UIButton *)button frame:(CGRect)frame image:(NSString *)image
{
    button.frame = frame;
    [button setImage:[UIImage imageNamed:image] forState:UIControlStateNormal];
    [button setTintColor:[UIColor whiteColor]];
    [self addSubview:button];
    
}
- (void)setTimeLabel:(CUSFlashLabel *)timeLabel
{
    timeLabel.textColor = [UIColor whiteColor];
    timeLabel.font = [UIFont boldSystemFontOfSize:13.0];
    [self addSubview:timeLabel];
    [timeLabel startAnimating];
}

- (void)setSongInfo:(CUSFlashLabel *)songInfo font:(CGFloat)font
{
    songInfo.textColor = [UIColor whiteColor];
    songInfo.font = [UIFont fontWithName:nil size:font];
    songInfo.textAlignment = UIBaselineAdjustmentAlignCenters;
    [songInfo startAnimating];
    [self addSubview:songInfo];
    
    
}

@end
